import { PORT1 } from "@/api/config/servicePort";

import http from "@/api";
import {ResPage} from "@/api/interface";
import {AuthItem} from "@/api/interface/auth";

/**
 * @name 用户管理模块
 */
// 获取用户列表
export const getGroups = () => {
	return http.get<ResPage<AuthItem>>(PORT1 + `/Auth/getGroups`);
};

/**
 * 获取权限列表数据
 * @param params
 */
export const getList = (params: any) => {
	return http.get<ResPage<AuthItem>>(PORT1 + `/Auth/index`, params);
}

export const editRule = (data: any) => {
	return http.post(PORT1 + `/Auth/editRule`, data)
}

/**
 * 获取权限细节列表数据
 */
export const getRuleList = (params: any) => {
	return http.get(PORT1 + `/Auth/getRuleList`, params);
}

/**
 * 修改权限组状态
 * @param params
 */
export const changeAuthGroupStatus = (params: { id: string; status: number }) => {
	return http.get(PORT1 + `/Auth/changeStatus`, params)
}

/**
 * 新增权限组
 * @param data
 */
export const addAuth = (data: AuthItem) => {
	return http.post(PORT1 + `/Auth/add`, data)
}

/**
 * 编辑权限组
 * @param data
 */
export const editAuth = (data: AuthItem) => {
	return http.post(PORT1 + `/Auth/edit`, data)
}

/**
 * 删除权限组
 */
export const delAuth = (params: { id: string }) => {
	return http.get(PORT1 + `/Auth/del`, params)
}

/**
 * 删除用户组成员
 * @param params
 */
export const delMember = (params: any) => {
	return http.get(PORT1 + `/Auth/delMember`, params)
}
